//
//  InputView.swift
//  FearfulNotification
//
//  Created by 筱鹏 on 2018/1/16.
//  Copyright © 2018年 筱鹏. All rights reserved.
//

import UIKit

class InputView: UIButton {

    var finishedClosure: (()->Void)?
    
    convenience init(title: String, _ finishClosure:@escaping ()->Void) {
        self.init(type: .custom)
        finishedClosure = finishClosure
        self.layer.borderColor = Theme.color.septationLine.cgColor
        self.layer.borderWidth = 0.5
        self.backgroundColor = Theme.color.background
        self.setTitle(title, for: .normal)
        self.setTitleColor(Theme.color.title, for: .normal)
        self.addTarget(self, action: #selector(InputView.finishAction), for: .touchUpInside)
        self.frame = CGRect(x: 0, y: 0, width: ScreenWidth, height: 44)
    }
    
    @objc func finishAction() {
        guard let closure = finishedClosure else { return }
        closure()
    }
}
